<?xml version="1.0"?>
<!-- TODO: check include Cpp support; add driver module template -->
<recipe>
    <mkdir at="${escapeXmlAttribute(projectOut)}/libs" />
    <mkdir at="${escapeXmlAttribute(projectOut)}/jniLibs" />
    <mkdir at="${escapeXmlAttribute(resOut)}/anim" />
    <mkdir at="${escapeXmlAttribute(resOut)}/drawable" />
    <mkdir at="${escapeXmlAttribute(resOut)}/drawable-xhdpi" />
    <mkdir at="${escapeXmlAttribute(resOut)}/drawable-xxhdpi" />
    <mkdir at="${escapeXmlAttribute(resOut)}/drawable-xxxhdpi" />
    <mkdir at="${escapeXmlAttribute(resOut)}/mipmap-hdpi" />
    <mkdir at="${escapeXmlAttribute(resOut)}/mipmap-xhdpi" />
    <mkdir at="${escapeXmlAttribute(resOut)}/mipmap-xxhdpi" />
    <mkdir at="${escapeXmlAttribute(resOut)}/mipmap-xxxhdpi" />
    <mkdir at="${escapeXmlAttribute(resOut)}/layout" />
    <mkdir at="${projectOut}/src/main/java/${slashedPackageName(packageName)}/mvp/model/api/service" />
    <mkdir at="${projectOut}/src/main/java/${slashedPackageName(packageName)}/mvp/model/api/cache" />
    <mkdir at="${projectOut}/src/main/java/${slashedPackageName(packageName)}/mvp/model/entity" />
    <mkdir at="${projectOut}/src/main/java/${slashedPackageName(packageName)}/mvp/presenter" />
    <mkdir at="${projectOut}/src/main/java/${slashedPackageName(packageName)}/mvp/contract" />
    <mkdir at="${projectOut}/src/main/java/${slashedPackageName(packageName)}/mvp/ui" />
    <mkdir at="${projectOut}/src/main/java/${slashedPackageName(packageName)}/app/service" />
    <mkdir at="${projectOut}/src/main/java/${slashedPackageName(packageName)}/app/receiver" />
    <mkdir at="${projectOut}/src/main/java/${slashedPackageName(packageName)}/util" />

    <mkdir at="${escapeXmlAttribute(topOut)}/signature" />
    <copy from="root/signature/signature.gradle"
                   to="${escapeXmlAttribute(topOut)}/signature/signature.gradle" />
    <copy from="root/signature/ztccollector.jks"
                   to="${escapeXmlAttribute(topOut)}/signature/ztccollector.jks" />

    <merge from="root/settings.gradle.ftl"
             to="${escapeXmlAttribute(topOut)}/settings.gradle" />
    <merge from="root/root-build.gradle.ftl"
             to="${escapeXmlAttribute(topOut)}/build.gradle" />         
    <copy from="root/versions.gradle"
                   to="${escapeXmlAttribute(topOut)}/versions.gradle" />

    <instantiate from="root/build.gradle.ftl"
                   to="${escapeXmlAttribute(projectOut)}/build.gradle" />
    <instantiate from="root/AndroidManifest.xml.ftl"
                   to="${escapeXmlAttribute(manifestOut)}/AndroidManifest.xml" />            
    <instantiate from="root/res/values/strings.xml.ftl"
                   to="${escapeXmlAttribute(resOut)}/values/strings.xml" />
    <instantiate from="root/res/values/dimens.xml.ftl"
                   to="${escapeXmlAttribute(resOut)}/values/dimens.xml" />
    <instantiate from="root/res/values/styles.xml.ftl"
                   to="${escapeXmlAttribute(resOut)}/values/styles.xml" />
    <copy from="root/res/values/colors.xml"
                   to="${escapeXmlAttribute(resOut)}/values/colors.xml" />
    <instantiate from="root/test/app_package/ExampleInstrumentedTest.java.ftl"
                   to="${escapeXmlAttribute(testOut)}/ExampleInstrumentedTest.java" />

    <#--  app configuration  -->
    <instantiate from="root/src/app_package/GlobalConfiguration.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/app/configuration/GlobalConfiguration.java" />
    <open file="${projectOut}/src/main/java/${slashedPackageName(packageName)}/app/configuration/GlobalConfiguration.java" />
    <instantiate from="root/src/app_package/AppLifecyclesImpl.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/app/configuration/AppLifecyclesImpl.java" />
    <open file="${projectOut}/src/main/java/${slashedPackageName(packageName)}/app/configuration/AppLifecyclesImpl.java" />
    <instantiate from="root/src/app_package/ActivityLifecycleCallbacksImpl.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/app/configuration/ActivityLifecycleCallbacksImpl.java" />
    <instantiate from="root/src/app_package/FragmentLifecycleCallbacksImpl.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/app/configuration/FragmentLifecycleCallbacksImpl.java" />
    <instantiate from="root/src/app_package/GlobalHttpHandlerImpl.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/app/configuration/GlobalHttpHandlerImpl.java" />
    <instantiate from="root/src/app_package/RequestDataEncryptCallBackImpl.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/app/configuration/RequestDataEncryptCallBackImpl.java" />
    <instantiate from="root/src/app_package/ResponseDataDecryptCallBackImpl.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/app/configuration/ResponseDataDecryptCallBackImpl.java" />      
    <#--  App  -->
    <instantiate from="root/src/app_package/AppConstants.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/app/AppConstants.java" />  
    <instantiate from="root/src/app_package/AppPreference.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/app/AppPreference.java" />   
    <#--  ARouter  -->
    <instantiate from="root/src/app_package/arouter/ARouterPathConstants.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/arouter/ARouterPathConstants.java" />     
    <instantiate from="root/src/app_package/arouter/DegradeServiceImpl.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/arouter/DegradeServiceImpl.java" />     
    <instantiate from="root/src/app_package/arouter/LoginStateInterceptor.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/arouter/LoginStateInterceptor.java" />     
    <instantiate from="root/src/app_package/arouter/PathReplaceServiceImpl.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/arouter/PathReplaceServiceImpl.java" />     
    <#--  EventBus  -->
    <instantiate from="root/src/app_package/event/BusEvent.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/event/BusEvent.java" />     
    <instantiate from="root/src/app_package/event/BusProvider.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/event/BusProvider.java" /> 
    <#--  UrlSchemeFilterActivity  -->
    <instantiate from="root/src/app_package/UrlSchemeFilterActivity.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/mvp/ui/UrlSchemeFilterActivity.java" />        
    <#--  Interceptor  -->
    <instantiate from="root/src/app_package/api/interceptor/AuthTokenInterceptor.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/mvp/model/api/interceptor/AuthTokenInterceptor.java" />  
    <#--  API  -->
    <instantiate from="root/src/app_package/api/ApiObserver.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/mvp/model/api/ApiObserver.java" />  
    <instantiate from="root/src/app_package/api/ApiServicePath.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/mvp/model/api/ApiServicePath.java" />  
    <instantiate from="root/src/app_package/api/ApiURLPath.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/mvp/model/api/ApiURLPath.java" />  
    <instantiate from="root/src/app_package/api/GlobalErrorProcessor.java.ftl"
                   to="${projectOut}/src/main/java/${slashedPackageName(packageName)}/mvp/model/api/GlobalErrorProcessor.java" />  

<#if unitTestsSupported>
    <instantiate from="root/test/app_package/ExampleUnitTest.java.ftl"
                   to="${escapeXmlAttribute(unitTestOut)}/ExampleUnitTest.java" />
</#if>


<#if !createActivity>
    <mkdir at="${escapeXmlAttribute(srcOut)}" />
</#if>

<#if makeIgnore>
    <copy from="root://gradle-projects/common/gitignore"
            to="${escapeXmlAttribute(projectOut)}/.gitignore" />
</#if>

<instantiate from="root/proguard-rules.txt.ftl"
                   to="${escapeXmlAttribute(projectOut)}/proguard-rules.pro" />

<copy from="root/res/mipmap-hdpi/ic_launcher.png"
        to="${escapeXmlAttribute(resOut)}/mipmap-hdpi/ic_launcher.png" />
<copy from="root/res/mipmap-xhdpi/ic_launcher.png"
        to="${escapeXmlAttribute(resOut)}/mipmap-xhdpi/ic_launcher.png" />
<copy from="root/res/mipmap-xxhdpi/ic_launcher.png"
        to="${escapeXmlAttribute(resOut)}/mipmap-xxhdpi/ic_launcher.png" />
<copy from="root/res/mipmap-xxxhdpi/ic_launcher.png"
        to="${escapeXmlAttribute(resOut)}/mipmap-xxxhdpi/ic_launcher.png" />

<copy from="root/res/drawable-xxhdpi/ic_back.png"
        to="${escapeXmlAttribute(resOut)}/drawable-xxhdpi/ic_back.png" />

</recipe>
